getGwQue();
setInterval("getGwQue()", 10000);


function getGwQue() {
    var dynamics = $('#dynamics');
    var id = dynamics.children("div[id]").eq(0).attr('id');
    if (id == '') {
        id = 0;
    } 
    var params = {};
    {
        params.Top = 3;//每次取几条
        params.action = "getquestionsdefault1";
        params.ID = id;
    }
    var _url = "https://v.91guoxin.com/Ajax/GuestAjax.aspx";
    $.ajax({
        dataType: "jsonp",
        url: _url,
        data: params,
        success: function (join) { 
               var  data =join;
            if (data.T1) {
                var html = '';
                 
                $.each(data.T1, function (k, que) {
                    if(que.Type==2){
                        var nas = que.CreatedTime.DateFormat("HH:mm");
                    }else{
                        var nas = que.AnswerTime.DateFormat("HH:mm");
                    }
                    html = html + '<div class="dynamics_X" id=' + que.ID + ' style=\"display:none\">';
                    html = html + '<h5><span class="left">' + que.RoomName + '</span><em class="right">' + nas + ' ' + que.RealName + '</em></h5>';
                    html = html + '    <dl>';
                    html = html + '<dt>' + que.Answer + '</dt>';
                    html = html + '<dd>';
                    html = html + '<span>' + que.NickName + '   ' + que.CreatedTime.DateFormat("HH:mm") + '</span>';
                    html = html + '<p>' + que.Question + '</p>';
                    html = html + '<i></i>';
                    html = html + '</dd>';
                    html = html + '</dl>';
                    html = html + '</div>'
                })
                if (id > 0) {
                    dynamics.prepend(html);
                } else {
                    dynamics.html(html);
                }
                if (html != '') {
                    dynamics.children().slideDown(1000);
                    dynamics.children(':gt(2)').slideUp(800,
                            function () {
                                jQuery(this).remove();
                            })
                }
            }
        }
    });
}
Date.prototype.Format = function (f) {
    var o = {
        "M+": this.getMonth() + 1,
        "d+": this.getDate(),
        "H+": this.getHours(),
        "m+": this.getMinutes(),
        "s+": this.getSeconds(),
        "q+": Math.floor((this.getMonth() + 3) / 3),
        "S": this.getMilliseconds()
    };
    if (/(y+)/.test(f)) {
        f = f.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length))
    };
    for (var k in o) {
        if (new RegExp("(" + k + ")").test(f)) {
            f = f.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length))
        }
    };
    return f
};
String.prototype.DateFormat = function (f) {
    if (this != "") {
        return new Date(this.replace(/-/g, "/")).Format(f)
    } else {
        return "信息错误"
    }
};